import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
// fix polyfill
import 'babel-polyfill';
import 'fetch-polyfill';
import 'es6-promise';
import 'shared/styles/index.less';

import App from './App';

const render = (Component) => {
  ReactDOM.render(
    <AppContainer>
      <Component />
    </AppContainer>,
    document.getElementById('app-root')
  );
};

render(App);

// Hot Module Replacement API
if (module.hot) {
  module.hot.accept('./App', () => render(App));
}

window.addEventListener('unhandledrejection', e => {
  e.preventDefault();
});
